/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webServices;

import businessLogic.DataMgr;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
import persistence.*;

/**
 *
 * @author thomashuttegger
 */
@WebService(serviceName = "AdminService")
@Stateless()
public class AdminService {
    @EJB
    private DataMgr ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "addClient")
    @Oneway
    public void addClient(Client cl) {       
        
             ejbRef.addClient(cl); 
    }
    
    @WebMethod(operationName = "getClientById")
    public Client getClientById(int id) {
                 
          return ejbRef.getClientById(id); 
        
    }

    @WebMethod(operationName = "addMedia")
    @Oneway
    public void addMedia(Medium md) {
        
        ejbRef.addMedia(md);
    }
    
    
    
    @WebMethod(operationName = "getShelfById")
    public Shelf getShelfById(int id) {
        
        return ejbRef.getShelfByID(id);
    }
    @WebMethod(operationName="addBook")
    public void addBook(String title, String isbn, String author) {
        ejbRef.addBook(title, isbn, author);
    }
}
